<template>
    <div>list</div>
    <a-button @click="addItem">操做</a-button>
    <div v-for="item in dataSource">
    {{ item.name }}-{{ item.age }}</div>
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue'
interface Props {
    list: any[]
}
const props = defineProps<Props>()
const emits = defineEmits(['update:list'])
const dataSource = computed({
    get() {
        return props.list
    },
    set(val) {
        console.log(99, val)
        emits('update:list', val)
    }
})
const addItem = () => {
    console.log(9999999)
    dataSource.value?.splice(1, 1, {
        name: 'enen',
        age: 28
    })
    // dataSource.value = dataSource.value.filter((item) => item.name !== 'cc')
    // console.log(dataSource.value)
}
</script>